#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>

#include "nweb.h"
#include "nweb_log.h"
#include "http_static_response.h"

/* Resource Handler */
void handle_static_resource(request_rec* r, int file_fd) {
    long ret;

    /* send file back to the web browser
     * send file in 8KB block - last block may be smaller 
     */
    while (	(ret = read(file_fd, r->buffer, BUFSIZE)) > 0 ) {
    	(void)write(r->fd,r->buffer,ret);
    }
}
